import React from 'react';
import {Button, Space} from "antd";
import AuthButton from "@/components/AuthButton";
import Pagination from "@/components/Pagination";
import {useSetState} from "ahooks";

const Auth = () => {
    const [page, setPage] = useSetState({
        pageNo: 1,
        pageSize: 10,
        total: 100
    })
    const onChange = (pageNo: number, pageSize: number) => {
        setPage({pageNo, pageSize})
    }
    return (
        <Space>

            <AuthButton authority={['test:test1:add']}>
                <Button type="primary">新增</Button>
            </AuthButton>
            <AuthButton authority={['test:test1:edit']}>
                <Button>编辑</Button>
            </AuthButton>
            <AuthButton authority={['test:test1:delete']}>
                <Button danger>删除</Button>
            </AuthButton>

            <Pagination total={page.total} pageNo={page.pageNo} pageSize={page.pageSize}
                        onChange={(pageNo: number, pageSize: number) => onChange(pageNo, pageSize)}/>
        </Space>
    );
};

export default Auth;
